import 'package:base_flutter/base_flutter.dart';
import 'package:saas_order_meal/net/apis.dart';
import 'package:saas_order_meal/net/net_response/code_value_list.dart';

class ComboModel extends BaseMvvmModel{
  @override
  void onCleared() {
  }

  ///获取字典值
  Future<List<CodeValueList>> getComboData(dynamic id) async {
    var map = {
      "codeTypeId":id
    };
    var data = await HttpGo.instance.postData(Apis.codeValue,data: map,options: Options(contentType: Headers.formUrlEncodedContentType));
    if("0"==data['code']){
      return ((data['data']['rows'] as List?)??[]).map((e) => CodeValueList.fromJson(e)).toList();
    }else{
      throw data['msg'];
    }
  }
}